/***
 * @Description:
 * @Author: LI Yihong
 * @Email: liyh@jihua.ac.cn
 * @Date: 2024-10-08 16:45:52
 * @LastEditTime: 2024-10-08 16:45:54
 * @LastEditors: LI Yihong
 * @FilePath: \RT_Stm32F7\applications\test\led.h
 */
#pragma once
#include <drivers/pin.h>
#include <memory>
#include <board.h>
#include "Thread.h"
#include "Semaphore.h"

using namespace rtthread;
using std::shared_ptr;

enum class LedState
{
    ON,
    OFF
};

class LED : public Thread
{
public:
    using Thread::Thread;

    void run(void *parameter) override;
    void setLedSem(shared_ptr<Semaphore> sem)
    {
        this->ledSem = sem;
    }

private:
    shared_ptr<Semaphore> ledSem;

    void setLed(rt_base_t led, LedState state);
    void ledLoop();
};
